import type { IRawContact } from "@/chatlog_types/IRawContact";
import { is_raw_contact_item_changed } from "@/chatlog_types/is_raw_contact_item_changed";
import { ListAutoWraper } from "@/utils/ListAutoWraper";
import { Dayjs } from "dayjs";
import { contact_adapter } from "./contact_adapter";
import type { ContactsMgr } from "./ContactsMgr";
import type { IContactItem } from "./IContactItem";
export class ContactListWraper extends ListAutoWraper<IContactItem, IRawContact> {
  readonly owner: ContactsMgr;
  constructor(owner: ContactsMgr) {
    super();
    this.owner = owner;
  }
  override is_change(a: IRawContact, b: IRawContact): boolean { return is_raw_contact_item_changed(a, b); }
  override cook(raw: IRawContact, now: Dayjs) { return contact_adapter(raw); }
  override raw(item: IContactItem) { return item.raw; }
  override key(item: IRawContact) { return item.userName; }
}
